﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiLightAttenuation : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiLightAttenuation(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiLightAttenuation obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiLightAttenuation()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiLightAttenuation(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGiLightAttenuation() : this(GlobalsPINVOKE.new_OdGiLightAttenuation(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setAttenuationType(OdGiLightAttenuation.AttenuationType typ)
		{
			GlobalsPINVOKE.OdGiLightAttenuation_setAttenuationType(this.swigCPtr, (int)typ);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiLightAttenuation.AttenuationType attenuationType()
		{
			OdGiLightAttenuation.AttenuationType result = (OdGiLightAttenuation.AttenuationType)GlobalsPINVOKE.OdGiLightAttenuation_attenuationType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setUseLimits(bool on)
		{
			GlobalsPINVOKE.OdGiLightAttenuation_setUseLimits(this.swigCPtr, on);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool useLimits()
		{
			bool result = GlobalsPINVOKE.OdGiLightAttenuation_useLimits(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setLimits(double startlim, double endlim)
		{
			GlobalsPINVOKE.OdGiLightAttenuation_setLimits(this.swigCPtr, startlim, endlim);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double startLimit()
		{
			double result = GlobalsPINVOKE.OdGiLightAttenuation_startLimit(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double endLimit()
		{
			double result = GlobalsPINVOKE.OdGiLightAttenuation_endLimit(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		public enum AttenuationType
		{
			kNone,
			kInverseLinear,
			kInverseSquare
		}
	}
}
